Einhugur JWT Plugin

JWTRawResult.ValidationResult Property

Validation result.

ValidationResult as UInt32 {Read}

Remarks

You should check this value to see if validation was successful or not.

Note this parameter contains bitmask so you should validate it like this:


if result.ValidationResult = result.ResultValid then
    MessageBox "Token is valid."
   
    for each claim as EinhugurJWT.Claim in result.Claims
       MessageBox claim.Key + " - " + claim.Value
    next
else
    // The result is bitmask and we can have multiple faults which is why we will not be using elseif here.
    if (result.ValidationResult and result.ResultTokenIsExpired) = result.ResultTokenIsExpired then
       MessageBox "Token has expired."
    end if
   
    if (result.ValidationResult and result.ResultTokenIsNotYetValid) = result.ResultTokenIsNotYetValid then
       MessageBox "The token is not yet valid."
    end if
   
    if (result.ValidationResult and result.ResultTokenNotIssuedYet) = result.ResultTokenNotIssuedYet then
       MessageBox "The token has not been issued yet, are you from the future?"
    end if
   
    if (result.ValidationResult and result.ResultAudienceClaimInvalid) = result.ResultAudienceClaimInvalid then
       MessageBox "The audience claim is invalid."
    end if
   
    if (result.ValidationResult and result.ResultIdClaimInvalid) = result.ResultIdClaimInvalid then
       MessageBox "The JWT ID claim is invalid."
    end if
   
    if (result.ValidationResult and result.ResultIssuerClaimInvalid) = result.ResultIssuerClaimInvalid then
       MessageBox "The issuer claim is invalid."
    end if
   
    if (result.ValidationResult and result.ResultSignatureVerificationFailure) = result.ResultSignatureVerificationFailure then
       MessageBox "The token was potentially tampered with: its signature couldn't be verified."
    end if
   
    if (result.ValidationResult and result.ResultSubjectClaimInvalid) = result.ResultSubjectClaimInvalid then
       MessageBox "The subject claim is invalid."
    end if
   
    if (result.ValidationResult and result.ResultTypeClaimFailure) = result.ResultTypeClaimFailure then
       MessageBox "The token's ""typ"" claim validation failed."
    end if
end if


See Also

JWTRawResult Class